package com.sxz.sbs.module.client.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sxz.sbs.R;
import com.sxz.sbs.app.GlideApp;
import com.sxz.sbs.module.client.bean.SelectStallBean;

import java.util.List;

/**
 *
 */

public class SelectStallAdapter extends BaseQuickAdapter<SelectStallBean.ListBean,BaseViewHolder>{

    public SelectStallAdapter(@Nullable List<SelectStallBean.ListBean> data) {
        super(R.layout.item_sale_control_stall_layout,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SelectStallBean.ListBean item) {
        helper.setText(R.id.tv_parking_stall_number,"车位编号  "+item.getNumber());
        helper.setText(R.id.tv_parking_stall_type,item.getSpaceTypeName());
        helper.setText(R.id.tv_parking_stall_price,item.getPriceAll());
        GlideApp.with(mContext).load(item.getPhotoUrl())
                .placeholder(R.drawable.img_default_stall)
                .error(R.drawable.img_default_stall).into((ImageView) helper.getView(R.id.iv_parking_stall));
        //#状态:0在售，1在售，2已定，3已售,
        switch (item.getStatus()) {
            case 0:
            case 1:
                helper.setText(R.id.tv_parking_stall_status,"在售");
                break;
            case 2:
                helper.setText(R.id.tv_parking_stall_status,"已定");
                break;
            case 3:
                helper.setText(R.id.tv_parking_stall_status,"已售");
                break;
            default:
                break;
        }
    }
}
